import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../bean/mall_home_entity.dart';
import '../../common/style/dimens.dart';
import '../image_view.dart';

/// @author zavier
/// @time 2023/12/26 10:39
/// @des 广告位

class HomeAdv extends StatelessWidget {
  final MallHomeDataAdvert? adv;
  final double aspectRatio;

  const HomeAdv({Key? key, this.adv, required this.aspectRatio}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return adv == null
        ? const SizedBox()
        : Container(
            margin: EdgeInsets.only(top: 12.r, left: Dimens.horizontalMargin, right: Dimens.horizontalMargin),
            child: AspectRatio(
              aspectRatio: aspectRatio,
              child: ImageView(
                url: adv?.image ?? '',
                fit: BoxFit.fill,
              ),
            ));
  }
}
